var database = require('../../data/data.js')
Page({

  data: {

  },
  onLoad: function (options) {

  },
  onShareAppMessage: function (res) {
    return {
      title: '企业趣味运动拓展',
      imageUrl: '/image/share.jpg',
      success: function (res) {
        wx.showToast({
          title: '转发成功',
          icon: 'success',
        })
      },
    }
  },
  dateChange: function (event) {
    this.setData({
      date: event.detail.value
    })
  },
  formSubmit: function (e) {
    if (e.detail.value.company != "" & e.detail.value.name != "" & e.detail.value.tel != "" & e.detail.value.time != "" & e.detail.value.people != "" & e.detail.value.view != "") {
      if (e.detail.value.tel.length==11){
        wx.request({
          url: database.url +'/project/planAdd.action?company=' + e.detail.value.company + '&name=' + e.detail.value.name + '&tel=' + e.detail.value.tel + '&time=' + e.detail.value.time + '&people=' + e.detail.value.people + '&view=' + e.detail.value.view,
          success(res) {
            wx.showToast({
              title: '预约成功',
              icon: 'success',
            })
          }
        })
      }else{
        wx.showToast({
          image: '/image/icon/fun2.png',
          title: '请填写正确的手机号',
        })
      }
     
    } else {
      wx.showToast({
        image:'/image/icon/fun2.png',
        title: '请填写完整',
      })
    }
  }
})